<?php

// +----------------------------------------------------------------------
// | H1CMS © OpenSource CMS
// +----------------------------------------------------------------------
// | Copyright (c) 2014-2016 http://www.h1cms.com All rights reserved.
// | Copyright (c) 2014-2016 嘉兴领格信息技术有限公司，并保留所有权利。
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Allen <allen@lg4.cn>
// +----------------------------------------------------------------------

namespace h1cms\model;

use h1cms\system\Model;

/**
 * Node
 *
 * @author Allen <allen@lg4.cn>
 * 
 * @property int $node_id Node Id
 * @property int $category_id Category Id
 */
class NodeCategory extends Model {

    public $table = 'node_category';
    public $primaryKey = 'node_id';

    public static function getCategoryIds($node_id) {
        $node_categorys = static::findAll(['node_id' => $node_id]);
        $category = [];
        foreach ($node_categorys as $row) {
            $category[] = $row->category_id;
        }
        return $category;
    }

}
